package com.fqdf.framework.android.net.response;


import java.util.List;


public class NetPageInfoBeanWrapper<T> extends NetBaseWrapper {

    private PageInfoMiddle<T> modelData;

    public int getPageNum() {
        return dataIsOK() ? modelData.getPageInfo().getPageNum() : 0;
    }

    public MidListRespBean<T> getPageInfo() {
        return dataIsOK() ? modelData.getPageInfo() : null;
    }

    public boolean dataIsOK() {
        return modelData != null && modelData.getPageInfo() != null;
    }

    public int getPageSize() {
        return dataIsOK() ? modelData.getPageInfo().getPageSize() : 0;
    }

    public int getPages() {
        return dataIsOK() ? modelData.getPageInfo().getPages() : 0;
    }

    public int getTotal() {
        return dataIsOK() ? modelData.getPageInfo().getTotal() : 0;
    }

    public List<T> getList() {
        return dataIsOK() ? modelData.getPageInfo().getList() : null;
    }

    @Override
    public String toString() {
        return super.toString() + "NetMidBeanWrapper{" +
                "modelData=" + modelData +
                '}';
    }

    public NetPageInfoBeanWrapper() {
        super();
    }

    public NetPageInfoBeanWrapper(boolean flag, String msg) {
        super(flag, msg);
    }

    public boolean isDataOK() {
        return modelData != null;
    }

    public PageInfoMiddle<T> getModelData() {
        return modelData;
    }

    public void setModelData(PageInfoMiddle<T> modelData) {
        this.modelData = modelData;
    }

    public class PageInfoMiddle<Q> extends NetBeanWrapper {

        private MidListRespBean<Q> pageInfo;
        private int count;
        private int totalCount;

        public int getCount() {
            return count;
        }

        public void setCount(int count) {
            this.count = count;
        }

        public int getTotalCount() {
            return totalCount;
        }

        public void setTotalCount(int totalCount) {
            this.totalCount = totalCount;
        }

        public MidListRespBean<Q> getPageInfo() {
            return pageInfo;
        }

        public void setPageInfo(MidListRespBean<Q> pageInfo) {
            this.pageInfo = pageInfo;
        }
    }
}
